package com.hejing.面向对象特征之二_继承.初识继承;

/**
 * ClassName: kids
 * Package: com.hejing.面向对象特征之二_继承
 * Description:
 *
 * @Author: HeJing
 * @Create: 2023-03-25 20:10
 * @Version: 1.0
 */
public class Kids extends ManKind{
    int yearsOld;

    // 构造器:

    public Kids() {
    }

    public Kids(int yearsOld) {
        this.yearsOld = yearsOld;
    }

    public Kids(int sex, int salary, int yearsOld) {
        this.yearsOld = yearsOld;
        this.setSalary(salary);
        this.setSex(sex);
    }

    public int getYearsOld() {
        return yearsOld;
    }

    public void setYearsOld(int yearsOld) {
        this.yearsOld = yearsOld;
    }

    // 方法:
    public void printAge() {
        System.out.println("yearsOld = " + yearsOld);
    }
}






















